<?php
class SchoolStagePanel extends QPanel {
    // Local instance of the SchoolStageMetaControl


    // Controls for SchoolStage's Data Fields
    public $lstStage;
    public $pnlEditStage;


    // Callback
    protected $strClosePanelMethod;

    public function __construct($objParentObject, $strClosePanelMethod, $strControlId = null) {
        // Call the Parent
        try {
            parent::__construct($objParentObject, $strControlId);
        } catch (QCallerException $objExc) {
            $objExc->IncrementOffset();
            throw $objExc;
        }

        // Setup Callback and Template
        $this->strTemplate = __DOCROOT__ . __MARKETING__ . '/tpl/SchoolStagePanel.tpl.php';
        $this->strClosePanelMethod = $strClosePanelMethod;

        $this->lstStage = new QListBox($this, $strControlId);
        $this->lstStage->Name = QApplication::Translate('Stage');
        $this->lstStage->Required = true;
        foreach (StageType::$NameArray as $intId => $strValue)
            $this->lstStage->AddItem(new QListItem($strValue, $intId));
        $this->lstStage->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstStage_Change'));


        $this->pnlEditStage = New QePanel($this);
        $this->lstStage_Change();
    }
     public function lstStage_Change(){
        if ($this->lstStage->SelectedValue)
            $_SESSION['Stage'] = $this->lstStage->SelectedValue;
        else
            $_SESSION['Stage'] = 1;
        //QApplication::DisplayAlert("Org = " . $_SESSION['Org']->Id . " Stage=". $_SESSION['Stage']);
        $this->pnlEditStage->Visible = false;
        $this->pnlEditStage->RemoveChildControls(true);
        $this->pnlEditStage = new SchoolStageEditPanel($this, 'ClosePanel');
        $this->pnlEditStage->Visible = true;

    }
}

    ?>